using System;
using System.Collections.Generic;
using DMS.BEs;

namespace DMS.Testing.ObjectMothers
{
    public static class InvoiceMother
    {
        private static Invoice invoiceDefault;
        private static Invoice invoiceOther;

        static InvoiceMother()
        {
            Reset();
        }

        public static IList<Invoice> GetInvoices()
        {
            return new List<Invoice> { GetInvoiceDefault(), GetInvoiceOther() };
        }

        public static Invoice GetInvoiceDefault()
        {
            return invoiceDefault;
        }

        public static Invoice GetInvoiceOther()
        {
            return invoiceOther;
        }

        public static void Reset()
        {
            Album album = AlbumMother.GetAlbumWith20Tracks();

            invoiceDefault = new Invoice { InvoiceDate = DateTime.Today, Customer = CustomerMother.GetCustomerDefault(), BillingCountry = "Ireland" };
            invoiceDefault.AddLine(new InvoiceLine { Track = album.GetTrack(0), Quantity = 5, UnitPrice = 2.8M });
            invoiceDefault.AddLine(new InvoiceLine { Track = album.GetTrack(3), Quantity = 12, UnitPrice = 1.1M });

            invoiceOther = new Invoice { InvoiceDate = DateTime.Today, Customer = CustomerMother.GetCustomerDefault(), BillingCountry = "Argentina" };
            invoiceOther.AddLine(new InvoiceLine { Track = album.GetTrack(0), Quantity = 1, UnitPrice = 3.8M });
            invoiceOther.AddLine(new InvoiceLine { Track = album.GetTrack(3), Quantity = 1, UnitPrice = 2.2M });
        }
    }
}